<?php session_start(); ?>
<?php
	if(!isset($_SESSION['ses_userid']) || $_SESSION['ses_level'] != 1){
		header("location:login.php");
		exit();
	}
?>
<?php require("../libraries/config.php"); ?>
<?php require("../libraries/database.php"); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Administrator</title>
<link href="styles/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../scripts/jquery-1.11.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
    $("#menu ul li.sub").hover(function(){
		$(this).find("ul").slideDown();
	},function(){
		$("#menu ul li.sub ul").hide();
	});
});
</script>
</head>

<body>
<div id="wrapper">
	<div id="header">
    	<a href="index.php"><img src="images/logo.png" width="100" /></a>
        <div class="users">
        	<ul>
            	<li><a href="#">Xin chào</a></li>
                <li><a href="#"><?php echo $_SESSION['ses_name']; ?></a></li>
                <li><a href="<?php echo baseurl; ?>" target="_blank">Xem trang chủ</a></li>
                <li><a href="logout.php" style="border:none">Thoát</a></li>
            </ul>
        </div>
    </div>
    <div id="content">
    	<div id="left">
        	<h2>Danh mục</h2>
            <ul>
            	<li><a href="<?php echo baseurl; ?>admin">Trang chủ</a></li>
                <li><a href="<?php echo baseurl."admin/?page=category&act=list"; ?>">Menu</a></li>
                <li><a href="<?php echo baseurl."admin/?page=user&act=list"; ?>">Thành viên</a>
                	<ul>
                    	<li><a href="<?php echo baseurl."admin/?page=user&act=list"; ?>">Danh sách</a></li>
                        <li><a href="<?php echo baseurl."admin/?page=user&act=add"; ?>">Thêm mới</a></li>
                    </ul>
                </li>
                <li><a href="<?php echo baseurl."admin/?page=news&act=list"; ?>">Tin tức</a>
                	<ul>
                    	<li><a href="<?php echo baseurl."admin/?page=news&act=list"; ?>">Danh sách</a></li>
                        <li><a href="<?php echo baseurl."admin/?page=news&act=add"; ?>">Thêm mới</a></li>
                    </ul>
                </li>
                <li><a href="<?php echo baseurl."admin/?page=product&act=list"; ?>">Sản phẩm</a>
                	<ul>
                    	<li><a href="<?php echo baseurl."admin/?page=product&act=list"; ?>">Danh sách</a></li>
                        <li><a href="<?php echo baseurl."admin/?page=product&act=add"; ?>">Thêm mới</a></li>
                    </ul>	
                </li>
                <li><a href="">Đơn hàng</a></li>
                <li><a href="<?php echo baseurl."admin/?page=intro"; ?>">Giới thiệu</a></li>
            </ul>
        </div>
        <div id="right">
        <?php
		if(isset($_GET['page'])){
			switch($_GET['page']){
				case "user" : require("modules/users/controller.php"); break;
				case "news" : require("modules/news/controller.php"); break;
				case "product" : require("modules/products/controller.php"); break;
				case "intro" : require("modules/intro/val.php"); break;
			}
		}else{
			require("home.php");
		}
		?>
        </div>
    </div>
    <div id="footer">
    	<h3>Đồ án website bán hàng online</h3>
        <p>Website được xây dựng bởi các học viên</p>
    </div>
</div>
</body>
</html>